// part1:C09:ex9.45.cpp
// prefix and suffix of string.
#include <iostream>
#include <vector>
#include <string>
using namespace std;

void name_string(string& name, const string& prefix,
                 const string& suffix) {
  name.insert(name.begin(), 1, ' ');
  name.insert(name.begin(), prefix.begin(), prefix.end());
  name.append(" ");
  name.append(suffix.begin(), suffix.end());
}

int main(void) {
  string s1 = "James Bond";
  name_string(s1, "Mr.", "II");
  cout << s1 << endl;

  s1 = "M";
  name_string(s1, "Mrs.", "III");
  cout << s1 << endl;
  
  return 0;
}
